package encore.portal.container;

import java.io.IOException;

import javax.portlet.PortletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Plex
 * PortletContainer 容器的接口
 */
public interface PortletContainer {
	/**
	 * 初始化容器时调用函数
	 * @throws PortletContainerException
	 */
	public void init()throws PortletContainerException;
	
	/**
	 * 容器销毁时调用函数
	 * @throws PortletContainerException
	 */
	public void destroy()throws PortletContainerException;
	
	
	/**
	 * 处理某个Portlet渲染时的动作
	 * @param portletWindow  渲染对象
	 * @param request        HttpServletRequest
	 * @param response
	 * @throws PortletException
	 * @throws IOException
	 * @throws PortletContainerException
	 */
	public void doRender(PortletWindow portletWindow,HttpServletRequest request,HttpServletResponse response)throws PortletException,IOException,PortletContainerException;
	
	/**
	 * 处理某个portlet资源服务时调用
	 * @param portletWindow   资源服务所在portlet
	 * @param request
	 * @param response
	 * @throws PortletException
	 * @throws IOException
	 * @throws PortletContainerException
	 */
	public void doServeResource(PortletWindow portletWindow,HttpServletRequest request,HttpServletResponse response)throws PortletException,IOException,PortletContainerException;
	
	/**
	 * 处理某个portlet动作时调用的函数
	 * @param portletWindow  动作调用Portlet
	 * @param request
	 * @param response
	 * @throws PortletException
	 * @throws IOException
	 * @throws PortletContainerException
	 */
	public void doAction(PortletWindow portletWindow,HttpServletRequest request,HttpServletResponse response)throws PortletException,IOException,PortletContainerException;
    
	/**
	 * 加载某个portlet时的动作
	 * @param portletWindow portlet对象
	 * @param request
	 * @param response
	 * @throws PortletException
	 * @throws IOException
	 * @throws PortletContainerException
	 */
	public void doLoad(PortletWindow portletWindow,HttpServletRequest request,HttpServletResponse response)throws PortletException,IOException,PortletContainerException;
	
	/**
	 * 对某个portlet进行管理操作的动作
	 * @param portletWindow  portlet对象
	 * @param request
	 * @param response
	 * @throws PortletException
	 * @throws IOException
	 * @throws PortletContainerException
	 */
	public void doAdmin(PortletWindow portletWindow,HttpServletRequest request,HttpServletResponse response)throws PortletException,IOException,PortletContainerException;
	
	/**
	 * 对某个portlet事件调用处理对象
	 * @param portletWindow  portlet对象
	 * @param request
	 * @param response
	 * @throws PortletException
	 * @throws IOException
	 * @throws PortletContainerException
	 */
	public void doEvent(PortletWindow portletWindow,HttpServletRequest request,HttpServletResponse response)throws PortletException,IOException,PortletContainerException;
	
	/**
	 * 判断容器是否创建了
	 * @return
	 */
	public boolean isInitialized();
	
	/**
	 * 获取容器名称
	 * @return
	 */
	public String getName();
	
	/**
	 * 获取容器服务对象
	 * @return
	 */
	public ContainerServices getContainerServices();

   
}
